package com.aiatomic.couting;

import com.aiatomic.couting.settings.FragmentSettings;

import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;

public class SettingActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_setting);
		FragmentSettings settings = new FragmentSettings();

		addFragment(settings);
	}

	public void addFragment(Fragment fragment) {
		FragmentManager fm = getFragmentManager();
		FragmentTransaction transaction = fm.beginTransaction();
		transaction.replace(R.id.id_content, fragment);
		transaction.addToBackStack(null);
		transaction.commit();
	}

	@Override

	public void onBackPressed() {

		FragmentManager fm = getFragmentManager();

		if (fm.getBackStackEntryCount() > 1) {

			fm.popBackStackImmediate();
			
		} else {
			this.finish();
		}

	}
}
